<!doctype html>
<html>
	<head>
		<title>我的旅游专家</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no, width=device-width">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="assets/css/amazeui.min.css">
		<link rel="stylesheet" href="assets/css/style.css">
		<style type="text/css">
		.am-checkbox .am-icon-checked, .am-checkbox .am-icon-unchecked, .am-checkbox-inline .am-icon-checked, .am-checkbox-inline .am-icon-unchecked, .am-radio .am-icon-checked, .am-radio .am-icon-unchecked, .am-radio-inline .am-icon-checked, .am-radio-inline .am-icon-unchecked{font-size: 2rem}
		.am-radio .am-icon-checked:before, .am-radio-inline .am-icon-checked:before {
		    content: "\f192";
		    color: #68bae0;
		}
		.steward .tab{margin-left:0; background: #f5f5f5;}
		.slide_up{
			display: none;
		}
		.steward .service-list1 p{
			line-height: 2rem;
			border:none;
		}
		</style>
	</head>
	<body>
		<div class="containter">
		  <header data-am-widget="header" class="am-header am-header-default">
		    <div class="am-header-left am-header-nav">
		      <a href="javascript:;"onClick="javascript :history.back(-1);">
		        <img src="assets/images/left.png">
		      </a>
		    </div>
		    <h1 class="am-header-title">
		      我的旅游专家
		    </h1>
		  </header>
		  <div style="width: 100%; height:4rem;"></div>
		  <div class="steward">
		    <p><a href=""><img src="assets/images/location.png" alt="">所在城市:<font id="position_city">石家庄</font></a></p>
		    <!-- <ul class="tab-left">
		      <li><a href="#">大鹏新区</a></li>
		      <li><a href="#">龙华新区</a></li>
		      <li><a href="#">光明新区</a></li>
		      <li class="active"><a href="#">坪山新区</a></li>
		      <li><a href="#">罗湖区</a></li>
		      <li><a href="#">福田区</a></li>
		      <li><a href="#">南山区</a></li>
		      <li><a href="#">宝安区</a></li>
		      <li><a href="#">龙岗区</a></li>
		      <li><a href="#">盐田区</a></li>
		      <li><a href="#">其他区</a></li>
		    </ul> -->
		    <div class="tab">
		      <section data-am-widget="accordion" class="am-accordion am-accordion-gapped" data-am-accordion='{  }'>
		       <!--<dl class="am-accordion-item">
		          <dt class="am-accordion-title">
		            莲花北营业部（张）
		          </dt>
		          <dd class="slide_up">
		            <div>
		              <ul>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck checked>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		              </ul>
		            </div>
		          </dd>
		        </dl>-->
		        <!--<dl class="am-accordion-item">
		          <dt class="am-accordion-title">
		            莲花北营业部（张）
		          </dt>
		          <dd class="slide_up">
		            <div>
		              <ul>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck checked>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		              </ul>
		            </div>
		          </dd>
		        </dl>
		        <dl class="am-accordion-item">
		          <dt class="am-accordion-title">
		            莲花北营业部（张）
		          </dt>
		          <dd class="slide_up">
		            <div>
		              <ul>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck checked>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		              </ul>
		            </div>
		          </dd>
		        </dl>
		        <dl class="am-accordion-item">
		          <dt class="am-accordion-title">
		            莲花北营业部（张）
		          </dt>
		          <dd class="slide_up">
		            <div>
		              <ul>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck checked>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio1" value="" data-am-ucheck>
		                  </label>
		                </li>
		              </ul>
		            </div>
		          </dd>
		        </dl>-->
		         <!--<dl class="am-accordion-item">
		          <dt class="am-accordion-title">
		            华联营业部
		          </dt>
		          <dd class="am-accordion-bd am-collapse">
		            <div class="am-accordion-content">
		              <ul>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio2" value="" data-am-ucheck checked>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio2" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio2" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio2" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio2" value="" data-am-ucheck checked>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio2" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio2" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio2" value="" data-am-ucheck>
		                  </label>
		                </li>
		
		              </ul>
		            </div>
		          </dd>
		        </dl>
		        <dl class="am-accordion-item am-active">
		          <dt class="am-accordion-title">
		            新洲绿景营业部
		          </dt>
		          <dd class="am-accordion-bd am-collapse am-in">
		            <div class="am-accordion-content">
		              <ul>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio3" value="" data-am-ucheck checked>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio3" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio3" value="" data-am-ucheck>
		                  </label>
		                </li>
		                <li>
		                  <img src="assets/images/head.png" alt="">
		                  <font>冯杰</font><br><span>手机号:13564865445</span>
		                  <label class="am-radio">
		                    <input type="radio" name="radio3" value="" data-am-ucheck>
		                  </label>
		                </li>
		              </ul>
		            </div>
		          </dd>
		        </dl>-->
		      </section>
		    </div>
		    <div class="service-list1">
				<div class="s-top"></div>
				<div class="s-center">
					<img src="assets/images/ren.png">
					<p>
						<span class="vlog_name">旅游专家</span><br>
						<span class="vlog_phone">1对1服务至心</span>
					</p>
					<button class="btn-left">选择专家</button>
					<button class="btn-right">暂不选择</button>
				</div>
			</div>
		  </div>
		</div>
		<script src="assets/js/jquery.min.js"></script>
		<script src="assets/js/amazeui.min.js"></script>
		<script src="assets/js/allUse.js"></script>
		<script>
			//所在城市
			if(window.sessionStorage.getItem("realposition")){
				var position_city=window.sessionStorage.getItem("realposition");
			}else{
				var position_city="深圳"
			}
			$("#position_city").html(position_city);
			//所在城市
			//旅游专家 弹窗
			$(".btn-right").click(function(){
				$(".s-center").slideUp(200,function(){
					$(".service-list1").hide();
					$(".s-center").show()
				});
			});
			$(".btn-left").click(function(){
				var obj2='{"name":"'+$(this).siblings("p").find($(".vlog_name")).html()+'","phone_num":'+$(this).siblings("p").find($(".vlog_phone")).html()+',"sales_id":'+$(this).attr("sales_id")+'}';
				
				console.log(headers);
				$.ajax({
					type:"post",
					url:url_enter+"/api/change_my_mavin",
					headers:headers,
					data:{
						"sales_id":$(this).attr("sales_id")
					},
					success:function(data){
						
						if(data.result===1){
							alert("操作成功");
							$.ajax({
								type:"post",
								url:url_enter+"/api/get_my_travel_mavin",
								async:false,
								headers:headers,
								data:{},
								success:function(data){
									console.log(data);
									if(data.result===1){//成功啦
										if(data.data!==null){//用户存在旅游专家 则调用存在旅游专家的方法 live1;
											var obj4='{"dep_id":"'+data.data.dep_id+'","head_img":"'+data.data.head_img+'","names":"'+data.data.names+'","dep_name":"'+data.data.dep_name+'","phone_num":"'+data.data.phone_num+'","qq":"'+data.data.qq+'"}'
											console.log(obj4);
											sessionStorage.setItem("my_volg",obj4)
											window.location.href = document.referrer;
										}else{
											var obj4="un";//若判断"my_volg"的值为"un"则不存在旅游专家 调用不存在旅游专家的方法 live2
											sessionStorage.setItem("my_volg",obj4);
											window.location.href = document.referrer;
										}
									}
									
									
								}
							});	
							//我的旅游专家以上
							
						}else if(data.result===105){
							alert(data.message);
							window.location.href="login.html"
						}else{
							alert(data.message);
						}
					}
				})
			})
			function radio_click(){
				$("input[type='radio']").click(function(){
					console.log($(this).parent(".am-radio"))
					var $this_parent=$(this).parent(".am-radio");
					
					$(".s-center img").attr("src",$this_parent.siblings("img").attr("src"));
					$(".s-center .vlog_name").html($this_parent.siblings("font").html());
					var sales_id=$this_parent.attr("sales_id");
					$(".s-center .btn-left").attr("sales_id",sales_id)
					$(".s-center .vlog_phone").html($this_parent.attr("phone_num"))
			   		$(".service-list1").show();						
			   });
			   
			}
			//旅游专家弹窗
	       var position_city=$("#position_city").html();
	       get_list2_ajax(position_city);
		   function get_list2_ajax(place){
		   				console.log(place)
		   			$.ajax({
		   				type:"get",
		   				url:url_enter+"/api/get_sales_department",
		   				headers:headers,
		   				data:{"city":place},
		   				success:function(data){
		   					console.log(data);
		   					//之所以箭头变化是因为有am-active class
		   					for(var i=0;i<data.data.length;i++){
		   						$("section").append('<dl class="am-accordion-item"><dt class="am-accordion-title" sales_dep_id="'
		   						+data.data[i].sales_dep_id+'">'
		   						+data.data[i].dep_name+'</dt><dd class="slide_up"><div><ul></ul></div></dd></dl>')
		   					};
		   					var flag1=true;
		   					function Pop(){
		   						
		   					}
		   					$(".am-accordion-title").click(function(){
		   						if(flag1){
			   						var sales_dep_id=$(this).attr("sales_dep_id");
			   						var $their=$(this)
			   						console.log($their.prop("flag3"));
			   						if($their.prop("flag3")===false){//这个列表已经加载过了！
			   							if($their.next($(".slide_up")).css("display")=="none"){
												$their.next($(".slide_up")).slideDown(300);
			   									$their.parent($(".am-accordion-item")).addClass("am-active").siblings().removeClass("am-active");

											}else{
												$their.next($(".slide_up")).slideUp(300);
				   								$their.parent($(".am-accordion-item")).removeClass("am-active");

											}
										$their.parent($(".am-accordion-item")).siblings().find($(".slide_up")).slideUp(300);
			   							return;
			   						}
			   						var $that=$(this).next($(".slide_up")).find($("div ul"));
			   						console.log($that);
			   						$.ajax({
			   							type:"post",
			   							url:url_enter+"/api/get_sales_detail",
			   							async:false,
			   							headers:headers,
			   							data:{
			   								"sales_dep_id":sales_dep_id
			   							},
			   							success:function(data){
			   								console.log(data)
			   								
			   								for(var i=0;i<data.data.sales_list.length;i++){
			   									$that.append('<li><img src="assets/images/head.png" alt=""><font>'
			   									+data.data.sales_list[i].names+'</font><br><span>手机号:<span class="phone_number1">'
			   									+data.data.sales_list[i].phone_num+'</span></span><label sales_id="'
			   									+data.data.sales_list[i].sales_id+'" phone_num="'
			   									+data.data.sales_list[i].phone_num+'" class="am-radio"><input type="radio" name="radio1" value="" data-am-ucheck class="am-ucheck-radio"><span class="am-ucheck-icons"><i class="am-icon-unchecked"></i><i class="am-icon-checked"></i></span></label></li>')
			   								};
			   								//我的手风琴
			   								radio_click();
												
												if($their.next($(".slide_up")).css("display")=="none"){
													$their.next($(".slide_up")).slideDown(200);
													$their.prop("flag3",false)
												}else{
													$their.next($(".slide_up")).slideUp(200);
												}
											$their.parent($(".am-accordion-item")).siblings().find($(".slide_up")).slideUp(200);
											//我的手风琴
			   								$their.parent($(".am-accordion-item")).addClass("am-active").siblings().removeClass("am-active");
			   								
			   							}
			   						});	
		   						}else{
		   							
		   						}
		   						
		   					})
		   				},
		   				error:function(xhr){
		   					console.log(xhr)
		   				}
		   			})
		   }
		</script>
	</body>
</html>